package com.wkck.controller.admin;

import com.wkck.VO.PageResult;
import com.wkck.domain.DeliveredLibraryHistory;
import com.wkck.dto.AuditParamsDto;
import com.wkck.dto.BackendResumeAuditConditionsDto;
import com.wkck.result.Result;
import com.wkck.service.ResumeDeliverService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: CK
 * @Date: 2024/03/28/22:48
 * @Description:
 */
@RequestMapping("/deliverBg")
@RestController
@Slf4j
@Api(value = "简历审核api",tags = "简历审核api")
@CrossOrigin
public class ResumeDeliverController {

    @Autowired
    private ResumeDeliverService deliverService;

    /***
    * @Author: CK
    * @Date: 2024/3/28
    * @Param: [dto]
    * @Description: 查询所有需要审核信息
    */
    @PostMapping("/get-all")
    @ApiOperation(value = "查询所有需要审核信息")
    public Result<PageResult> getAllResumeAudit(@RequestBody BackendResumeAuditConditionsDto dto) {
        log.info("查询条件dto : {}", dto);
        return Result.success(deliverService.getAllResumeAudit(dto));
    }

    /***
    * @Author: CK
    * @Date: 2024/3/29
    * @Param: [id]
    * @Description: 检查用户简历是否存在
    */
    @GetMapping("/check-user-deliver/{id}")
    @ApiOperation(value = "检查用户简历是否存在")
    public Result<Boolean> checkUserDeliverResume(@PathVariable Long id) {
        log.info("检查用户简历是否存在 ====> {}", id);
        return Result.success(deliverService.checkUserDeliverResume(id));
    }


    /***
     * @Author: CK
     * @Date: 2024/3/29
     * @Param: [id]
     * @Description: 检查用户简历是否存在
     */
    @GetMapping("/check-user-deliver-batch")
    @ApiOperation(value = "检查用户简历是否存在")
    public Result<Boolean> checkBatchUserDeliverResume(@RequestParam("ids") List<Long> ids) {
        log.info("检查用户简历是否存在 ====> {}", ids);
        return Result.success(deliverService.checkBatchUserDeliverResume(ids));
    }

    /***
    * @Author: CK
    * @Date: 2024/3/29
    * @Param: [AuditParamsDto]
    * @Description: 审核投递简历
    */
    @PutMapping("/audit-data")
    @ApiOperation(value = "审核投递简历")
    public Result<Boolean> auditUserDeliverResume(@RequestBody AuditParamsDto dto) {
        log.info("需要审核的 : {}", dto);
        return Result.success(deliverService.auditUserDeliverResume(dto));
    }

    /***
    * @Author: CK
    * @Date: 2024/3/29
    * @Param: [id]
    * @Description: 获取用户的已投递的简历详情
    */
    @GetMapping("/get-deliver/{id}")
    @ApiOperation(value = "获取用户的已投递的简历详情")
    public Result<List<DeliveredLibraryHistory>> getUserDeliverInfoById(@PathVariable Long id) {
        log.info("获取用户的已投递的简历详情 ====> {}", id);
        return Result.success(deliverService.getUserDeliverInfoById(id));
    }
}
